#ifndef _AMERICO_VOLUMES_MATH_H_
#define _AMERICO_VOLUMES_MATH_H_

#include "Matrix33.h"
#include "Matrix44.h"
#include "Intersection.h"
#include "VectorOperations.h"

Intersection::AABB operator*(const Intersection::AABB &anAABB, const Matrix44f &aMatrix)
{
	Intersection::AABB result;
	result.myCenterPos = Convert(aMatrix*Convert(anAABB.myCenterPos));
	result.myExtents = abs(Convert(aMatrix)) * anAABB.myExtents;
	result.myMinPos = result.myCenterPos - result.myExtents;
	result.myMaxPos = result.myCenterPos + result.myExtents;
	return result;
}

Intersection::Sphere operator*(const Intersection::Sphere &aSphere, const Matrix44f &aMatrix)
{
	Intersection::Sphere result;
	result.myCenterPosition = Convert(aMatrix*Convert(aSphere.myCenterPosition));
	result.myRadius = aMatrix[0] * aSphere.myRadius;
	result.myRadiusSquared = result.myRadius * result.myRadius;
	return result;
}

#endif